package com.ysb.searchserver;

import java.util.ArrayList;
import java.util.List;

import javax.sql.rowset.CachedRowSet;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;

public class EnglishExamSearcher extends ExamSearcher{

	public EnglishExamSearcher() throws Throwable {
		super();
	}

	@Override
	protected Analyzer getAnalyzer() {
		return new StandardAnalyzer();
	}

	@Override
	protected List<ExamSentence> getExamSentences(int id) throws Throwable {
		//TODO 临时先用examPeriodId顶一下，等着后面db改造
		CachedRowSet crs = DBUtil.select("select id, content, examPeriodId from exam_article");
		List<ExamSentence> list = new ArrayList<ExamSentence>(crs.size());
		while(crs.next()) {
			list.add(new ExamSentence(crs.getInt("id"), crs.getLong("examPeriodId"), crs.getString("content")));
		}
		return list;
	}

}
